#!/usr/bin/env python

from corefacade import AppFacade


QML_FILE_NAME = None
WINDOW_TITLE = "Bloodnica"

from PySide import QtCore
from PySide import QtGui
from PySide import QtDeclarative
from PySide import QtNetwork
import sys

import os
from PySide.phonon import Phonon


__author__ = 'cjay'


windowWidth = 960
windowHeight = 720

class MainWidget(QtGui.QWidget):
    def __init__(self):
        super(MainWidget,self).__init__()

        self.video = None
        self.resize(windowWidth,windowHeight)
        self.setWindowTitle('Bloodnica')

        qml = self.qml = QtDeclarative.QDeclarativeView(self)
        path = QtCore.QUrl.fromLocalFile(QML_FILE_NAME or __file__.replace('.py', '.qml'))
        qml.setSource(path)
        qml.setWindowTitle(WINDOW_TITLE)

        #    PHONON
        #file_path = os.path.join(os.path.dirname(__file__), 'videos\\test_low.mp4')
        #media_src = Phonon.MediaSource(file_path)
        #self.media = media_obj = Phonon.MediaObject()
        #media_obj.setCurrentSource(media_src)
        #video_widget = self.video = Phonon.VideoWidget(self)
        #video_widget.setGeometry(9, 10, 660, 441)
        #Phonon.createPath(media_obj, video_widget)
        #self.audio_out = audio_out = Phonon.AudioOutput(Phonon.VideoCategory)
        #Phonon.createPath(media_obj, audio_out)
        #    PHONON END
        #media_obj.play()

        self.facade = AppFacade.getInstance()
        self.facade.startup(self)

if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    app.setApplicationName("bloodnica_app")
    wid = MainWidget()


    wid.show()
    app.exec_()

    
#    hello_layer = MainLayer()
